<template>

  <!-- table区域 -->
  <div>
    <a-table ref="table" bordered size="middle" rowKey="logId" :columns="columns"
             :dataSource="tableDataSource()"
             :pagination="ipagination"
             :loading="loading"
             @change="handleTableChange">
    </a-table>
  </div>
</template>

<script>
import {JeecgListMixin} from '@/mixins/JeecgListMixin'

export default {
  name: "Log",
  mixins: [JeecgListMixin],
  data() {
    return {
      title: '日志管理',
      model: {},
      columns: [
        {
          title: '用户账号',
          align: "center",
          dataIndex: 'userId',
          width: 60
        },
        {
          title: '访问URL',
          align: "center",
          dataIndex: 'url',
          width: 100,
        },
        {
          title: '客户端IP',
          align:"center",
          dataIndex: 'clientIp',
          width: 60,
        },
        {
          title: '访问开始时间',
          align:"center",
          dataIndex: 'beginTime',
          width: 60,
        },
        {
          title: '返回码',
          align:"center",
          dataIndex: 'returnStatusCode',
          width: 60,
        }

      ],
      url: {
        list: "/sys/log/page",
      },
      dataSource2: [],
    }
  },
  computed: {

  },
  methods: {
    tableDataSource() {
      this.dataSource2 = this.dataSource
      this.dataSource2.forEach((item)=>{
          var now = new Date(item.beginTime),
              y = now.getFullYear(),
              m = now.getMonth() + 1,
              d = now.getDate();
          item.beginTime = y + "-" + (m < 10 ? "0" + m : m) + "-" + (d < 10 ? "0" + d : d) + " " + now.toTimeString().substr(0, 8);
      })
      return this.dataSource2;
    }
  },

  created() {

  },
  mounted() {

  }
}
</script>

<style scoped>

</style>